<!DOCTYPE html>    
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script>
			// let  ages = new Array();
			
			
			//int ages = new int[6]{10,20,30,"asdfasf"};
			
			//初始化
			let  ages = [22,
						21,
						20,
						21,
						20,
						19,
						"张飞", 
						[999,88],
						];
			
			console.log("ages.length",ages.length);
			
			console.log(ages);
			  
			  
			  
			//遍历
			for(let i = 0 ;i <100  ;i++){
				console.log("ages["+i+"]",ages[i]);
			}
			
			
			
			ages[20]  = 20;
			
			console.log(ages);
			
			
			
			
			//对数组的操作
			
			let arr = [1,2,3,4,5];
			
			//出栈
			console.log(arr.pop());
			
			console.log("arr",arr);  //[1,2,3,4]
			
			
			//push 在数组末尾追加
			arr.push('5')
			console.log("arr",arr);  //[1,2,3,4,'5']
			
			
			console.log("arr.shift()",arr.shift())
			console.log("arr",arr);  //[2,3,4,'5']
			arr.unshift("start")
			console.log("arr",arr);  //['start',2,3,4,'5']
			
			
			//arr slice
			console.log('arr.slice(1,4):新数据',arr.slice(1,4))
			console.log('arr',arr)
			
		
			
			let arr2 = [1,2,3,4,5];
			console.log('arr2.join("--")',arr2.join("--"));
			console.log('typeof arr2.join("--")' ,typeof(arr2.join("--")))
			
			//遍历 2
			for (let i in arr2) {
				console.log("arr2[i]",arr2[i]);
			}
			//遍历 3
			arr2.forEach(function(item , index ){
				console.log("item->",item)
			})
			
			
			
			
			
			
			
			
        </script>
    </head>
    <body>
        <h3>请打开浏览器控制台，观察结果</h3>
    </body>
</html>
